/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.statemachine.figure;

import org.eclipse.draw2d.FreeformLayer;
import org.eclipse.draw2d.FreeformLayout;
import org.eclipse.draw2d.FreeformViewport;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.ScrollPane;
import org.eclipse.draw2d.geometry.Rectangle;

import com.cea.papyrus.core.figures.ElementFigure;
import com.cea.papyrus.core.utils.Debug;

/**
 * 
 */
public class SplitterFigure extends ElementFigure{
	
	/**
	 * 
	 */
	private int debugChannel = 501;
	
	/**
	 * 
	 */
	private IFigure pane;
	
	/**
	 * 
	 */
	protected ScrollPane scrollpane;


	/**
	 * 
	 */
	public SplitterFigure(){
		// Set content layout
		setLayoutManager(new FreeformLayout());
		// Add pane for content
		pane = new FreeformLayer();
		pane.setLayoutManager(new FreeformLayout());
		
		// Add scrollpane
		ScrollPane scrollpane = new ScrollPane();
		FreeformViewport viewport = new FreeformViewport();
		scrollpane.setViewport(viewport);
		scrollpane.setContents(pane);
		this.add(pane);
		
		setOpaque(false);
	}
	
	/**
	 * 
	 * 
	 * @return 
	 */
	@Override
	public IFigure getContentPane(){
		return pane;
	}
	
	/**
	 * 
	 * 
	 * @param rect 
	 */
	@Override
	public void setBounds(Rectangle rect){
		super.setBounds(new Rectangle(rect));
		Debug.debug(this," bounds are : " +getBounds(), debugChannel);
	}

	/**
	 * Overriden to get rid of the border.
	 * 
	 * @param border 
	 */
	@Override
	protected void paintBorder(Graphics graphics) {};


}
